﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Worldme.YHChatSDK.Common.Constant;

namespace Worldme.YHChatSDK.Framework.Vo.V1.Req
{
    /// <summary>
    /// 设置看板请求体
    /// </summary>
    public class ApiSetBoardReqV1
    {
        /// <summary>
        /// 接收消息对象ID
        /// 用户: userId 
        /// 群: groupId
        /// </summary>
        public string? chatId { get; set; }
        /// <summary>
        /// 接收对象类型
        /// 用户: user 
        /// 群: group
        /// </summary>
        public string? chatType { get; set; }
        /// <summary>
        /// 群成员用户ID
        /// 如果chatType为 group 时，此字段生效
        /// 可为指定群成员设置看板
        /// </summary>
        public string memberId { get; set; }
        /// <summary>
        /// 消息类型，取值如下
        /// text\markdown\html
        /// </summary>
        public string contentType { get; set; }
        /// <summary>
        /// 内容文本
        /// </summary>
        public string content { get; set; }
        /// <summary>
        /// 过期时间的时间戳
        /// 秒级时间戳，0 为不过期
        /// 非必填，默认为0
        /// </summary>
        public int expireTime { get; set; }

        /// <summary>
        /// 文本看板
        /// 如果要设置全局看板，chatType和chatId请传null
        /// </summary>
        /// <param name="chatType">RecvTypeConstant.</param>
        /// <param name="chatId">当为USER时，填用户ID，当为GROUP时，填群ID</param>
        /// <param name="content">看板内容</param>
        /// <param name="expireTime">过期时间，秒级，0 为不过期</param>
        /// <returns></returns>
        public ApiSetBoardReqV1 Text(string chatType, string chatId, string content, int expireTime = 0)
        {
            this.chatType = chatType;
            this.chatId = chatId;
            contentType = ContentTypeConstant.TEXT;
            this.content = content;
            this.expireTime = expireTime;
            return this;
        }


        /// <summary>
        /// 给指定群成员设置文本看板
        /// </summary>
        /// <param name="chatId">群ID</param>
        /// <param name="memberId">群成员ID</param>
        /// <param name="content">看板内容</param>
        /// <param name="expireTime">过期时间，秒级，0 为不过期</param>
        /// <returns></returns>
        public ApiSetBoardReqV1 TextForGroup(string chatId,string memberId, string content, int expireTime = 0)
        {
            this.chatType = RecvTypeConstant.GROUP;
            this.chatId = chatId;
            this.memberId = memberId;
            contentType = ContentTypeConstant.TEXT;
            this.content = content;
            this.expireTime = expireTime;
            return this;
        }


        /// <summary>
        /// Markdown看板
        /// 如果要设置全局看板，chatType和chatId请传null
        /// </summary>
        /// <param name="chatType">RecvTypeConstant.</param>
        /// <param name="chatId">当为USER时，填用户ID，当为GROUP时，填群ID</param>
        /// <param name="content">md消息内容</param>
        /// <param name="expireTime">过期时间，秒级，0 为不过期</param>
        /// <returns></returns>
        public ApiSetBoardReqV1 Markdown(string chatType, string chatId, string content, int expireTime = 0)
        {
            this.chatId = chatId;
            this.chatType = chatType;
            contentType = ContentTypeConstant.MARKDOWN;
            this.content = content;
            this.expireTime = expireTime;
            return this;
        }

        /// <summary>
        /// 给指定群成员设置Markdown看板
        /// </summary>
        /// <param name="chatId">群ID</param>
        /// <param name="memberId">群成员ID</param>
        /// <param name="content">看板内容</param>
        /// <param name="expireTime">过期时间，秒级，0 为不过期</param>
        /// <returns></returns>
        public ApiSetBoardReqV1 MarkdownForGroup(string chatId, string memberId, string content, int expireTime = 0)
        {
            this.chatId = chatId;
            this.chatType = chatType;
            this.memberId = memberId;
            contentType = ContentTypeConstant.MARKDOWN;
            this.content = content;
            this.expireTime = expireTime;
            return this;
        }

        /// <summary>
        /// Html看板
        /// 如果要设置全局看板，chatType和chatId请传null
        /// </summary>
        /// <param name="chatType">RecvTypeConstant.</param>
        /// <param name="chatId">当为USER时，填用户ID，当为GROUP时，填群ID</param>
        /// <param name="content">html消息内容</param>
        /// <param name="expireTime">过期时间，秒级，0 为不过期</param>
        /// <returns></returns>
        public ApiSetBoardReqV1 Html(string chatType, string chatId, string content, int expireTime = 0)
        {
            this.chatId = chatId;
            this.chatType = chatType;
            contentType = ContentTypeConstant.HTML;
            this.content = content;
            this.expireTime = expireTime;
            return this;
        }

        /// <summary>
        /// 给指定群成员设置Html看板
        /// </summary>
        /// <param name="chatId">群ID</param>
        /// <param name="memberId">群成员ID</param>
        /// <param name="content">看板内容</param>
        /// <param name="expireTime">过期时间，秒级，0 为不过期</param>
        /// <returns></returns>
        public ApiSetBoardReqV1 HtmlForGroup(string chatId, string memberId, string content, int expireTime = 0)
        {
            this.chatId = chatId;
            this.chatType = chatType;
            this.memberId = memberId;
            contentType = ContentTypeConstant.HTML;
            this.content = content;
            this.expireTime = expireTime;
            return this;
        }
    }
}
